package com.aloda.controller.admin;

import com.aloda.dto.UserPageDTO;
import com.aloda.result.PageResult;
import com.aloda.result.Result;
import com.aloda.service.UserService;
import com.aloda.vo.UserPageVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户管理端controller
 */
@Slf4j
@RestController("adminUserController")
@Tag(name = "管理端用户相关接口")
@RequestMapping("/admin/user")
public class UserController {

    @Resource
    private UserService userService;

    /**
     * 分页查询用户
     * @param userPageDTO
     * @return
     */
    @Operation(summary = "分页查询用户")
    @PostMapping("/page")
    public Result<PageResult<UserPageVO>> pageQuery(@RequestBody UserPageDTO userPageDTO) {
        log.info("用户分页查询:{}",userPageDTO);
        PageResult<UserPageVO> pageResult = userService.pageQuery(userPageDTO);
        return Result.success(pageResult);
    }
}
